import { Navigate, Route, Routes } from "react-router-dom";
import "antd/dist/antd.css";

import Login from "./containers/login";
import Admin from "./containers/admin";
import Home from "./components/home";
import Category from "./containers/category";
import Product from "./containers/product";
import Detail from "./containers/product/detail";
import Add_Update from "./containers/product/add_update";
import User from "./containers/user";
import Role from "./containers/role";
import Bar from "./containers/bar";
function App() {
  return (
    <div className="app">
      <Routes>
        <Route path="/login" element={<Login />} />
        <Route path="/admin" element={<Admin />}>
          <Route path="home" element={<Home />} />
          <Route path="products/category" element={<Category />} />
          <Route path="products/product" element={<Product />} />
          <Route path="products/product/detail/:id" element={<Detail />} />
          <Route path="products/product/add_update" element={<Add_Update />} />
          <Route
            path="products/product/add_update/:id"
            element={<Add_Update />}
          />
          <Route path="user" element={<User />} />
          <Route path="role" element={<Role />} />
          <Route path="charts/bar" element={<Bar />} />
        </Route>
        <Route path="*" element={<Navigate to="/login" />} />
      </Routes>
    </div>
  );
}

export default App;
